package juc.future;

import java.util.concurrent.*;

/**
 * @author fangbin
 * @desc
 * @date 2020/6/30 20:17
 */
public class GetException {

    public static void main(String[] args) {

        ExecutorService executorService = Executors.newFixedThreadPool(20);

        Future<Integer> future = executorService.submit(new CallableTask());

        try {
            Thread.sleep(5000);
            System.out.println(future.isDone());
            future.get();
        } catch (InterruptedException e) {
            System.out.println("InterruptedException");
            e.printStackTrace();
        } catch (ExecutionException e) {
            System.out.println("ExecutionException");
            e.printStackTrace();
        }
    }
    static class CallableTask implements Callable<Integer>{
        @Override
        public Integer call() throws Exception {
            throw  new IllegalArgumentException();
        }
    }
}
